﻿#ifndef WORKER_H
#define WORKER_H

#include <QObject>

//QThread thread;
//Worker worker;
//QObject::connect(&worker, SIGNAL(finished()), &thread, SLOT(quit()));
//QObject::connect(&worker, SIGNAL(finished()), &worker, SLOT(deleteLater()));
//QObject::connect(&thread, SIGNAL(finished()), &thread, SLOT(deleteLater()));
//worker.moveToThread(&t);
//thread.start();
// ....
//worker.stop();
//thread.wait();

class Worker : public QObject
{
	Q_OBJECT

public:
	Worker(QObject *parent = nullptr);
	~Worker();
	void cancel();
	void stop();

protected:
	bool m_bCancel;

signals:
	void finished();
};


// 登录线程执行模块
class LoginWorker : public Worker
{
	Q_OBJECT
	
protected slots:
	int onLogin(QString strUserName, QString strPwd);

signals:
	// 登录模块执行结束
	void complete(int);
};

#endif // WORKER_H
